/* eslint-disable import/prefer-default-export */
import request from '@/utils/request';

// 角色管理
// 列表接口
export async function getPageList(params) {
  return request(`/mgrApi/role/pageList`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 所属系统字典数据
export async function getFetchCode(params) {
  return request(`/mgrApi/sys/listBaseSys`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

export async function getListUserInfo(params) {
  return request(`/mgrApi/user/pagelistUserInfo`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

export async function getDictList(params) {
  return request(`/csApi/mdm/nmDict/queryDictItemsByCodes`, {
    method: 'POST',
    body: params,
  });
}

export async function getOrgInfo(params) {
  return request(`/mgrApi/org/queryOrgInfo`, {
    method: 'POST',
    body: params,
  });
}
// mgrApi/org/queryOrgListByParentId
export async function queryOrgListByParentId(params) {
  return request(`/mgrApi/org/queryNextOrgList`, {
    method: 'POST',
    body: params,
  });
}

export async function queryBaseRoleLike(params) {
  return request(`/mgrApi/role/listBaseRoleLike`, {
    method: 'POST',
    body: params,
  });
}

export async function insertUserInfo(params) {
  return request(`/mgrApi/user/insertUserInfo`, {
    method: 'POST',
    body: params,
  });
}

export async function queryUserInfoById(params) {
  return request(`/mgrApi/user/queryUserInfoById`, {
    method: 'POST',
    body: params,
  });
}

export async function updateUserInfo(params) {
  return request(`/mgrApi/user/updateUserInfo`, {
    method: 'POST',
    body: params,
  });
}

export async function resetUserPwd(params) {
  return request(`/mgrApi/user/restUserPwd`, {
    method: 'POST',
    body: params,
  });
}

export async function getDetailInfo(params) {
  return request(`/mgrApi/user/queryUserInfoById`, {
    method: 'POST',
    body: params,
  });
}

export async function enOrdisableUser(params) {
  return request(`/mgrApi/user/enOrdisableUser`, {
    method: 'POST',
    body: params,
  });
}

export async function deleteUserInfo(params) {
  return request(`/mgrApi/user/deleteUserInfo`, {
    method: 'POST',
    body: params,
  });
}
// 获取机构信息
export async function getOrgList(params) {
  return request(`/mgrApi/org/queryOrgInfo`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 获取机构子列表
export async function getOrgChildList(params) {
  return request(`/mgrApi/org/queryOrgListByParentId`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 获取列表数据
export async function getPageDataList(params) {
  return request(`/mgrApi/org/pageOrgListByParentId`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 新增数据
export async function insertInfo(params) {
  return request(`/mgrApi/org/insertOrgInfo`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 获取修改信息
export async function queryOrgById(params) {
  return request(`/mgrApi/org/queryOrgById`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 修改数据
export async function updateOrgInfo(params) {
  return request(`/mgrApi/org/updateOrgInfo`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 删除数据
export async function deleteOrgById(params) {
  return request(`/mgrApi/org/deleteOrgById`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 获取服务地区下拉数据
export async function getAreaList(params) {
  return request(`/mgrApi/suppBusiScope/getRespAreaList`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
export async function deleteBaseRole(params) {
  return request(`/mgrApi/role/deleteBaseRole`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
export async function updateBaseRole(params) {
  return request(`/mgrApi/role/updateBaseRole`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 所属用户
export async function getQueryUserByOrgId(params) {
  return request(`/mgrApi/user/queryUserByOrgId`, {
    method: 'POST',
    body: params,
  });
}
// 根据公司查询所有业务客户接口    --关联客户
export async function getCustList(params) {
  return request(`/csApi/custInfo/likeName`, {
    method: 'POST',
    body: params,
  });
}
// 角色回显，根据所属用户id查角色
export async function echoRoleList(params) {
  return request(`/mgrApi/user/queryUserInfoById`, {
    method: 'POST',
    body: params,
  });
}
